package com.wdc.test;

import java.awt.event.MouseAdapter;

public class Daffodils {


    public static void main(String[] args) {
        for (int i = 1; i <= 1000; i++) {
            if (isDaffodils(i)) {
                System.out.println(i);
            }

        }

        int digits = (int) Math.log10(999324) + 1; // 获取数字的位数
        System.out.println(digits);


    }




    public static boolean isDaffodils(int num) {
        if (num >= 1 && num < 10) {
            if (num == num * num * num) {
                return true;
            }
        }else if (num >= 10 && num < 100) {
            int g = num % 10;
            int s = num / 10;
            if (num == g * g * g + s * s * s) {
                return true;
            }
        }else if (num >= 100 && num < 1000) {
            int g = num % 10;
            int s = num / 10 % 10;
            int b = num / 100;
            if (num == g * g * g + s * s * s + b * b * b) {
                return true;
            }
        }


        return false;

    }

}
